﻿using ASmile.Com;
using ASmile.Com.Report;
using ASmile.DBModel;
using System.Collections.Generic;

namespace ASmile.Win.DaBLL
{
    class ReportBLL : BLLCrud<ArgGetReport, Sys_ReportArg>, IReportBLL
    {
        protected override string ControllerName => "SysManage/Report";

        /// <summary>
        /// 根据 FormName 获取report主记录与明细记录
        /// </summary>
        public ApiResult<RetVModel> GetVModel(ArgGetReport arg)
        {
            return GetResult<RetVModel>(arg);
        }
        /// <summary>
        /// 根据 FormName 获取report主记录
        /// </summary>
        public ApiResultList<Sys_Report> GetReportList(ArgGetReport arg)
        {
            return GetResultList<Sys_Report>(arg);
        }
        /// <summary>
        /// 新增report主记录
        /// </summary>
        public ApiResult<string> AddReport(Sys_Report model)
        {
            return GetResult<string>(model);
        }
        /// <summary>
        /// 更新 report 主记录
        /// </summary>
        public ApiResult<string> EditReport(Sys_Report model)
        {
            return GetResult<string>(model);
        }
        /// <summary>
        /// 删除 report 主记录
        /// </summary>
        public ApiResult DelReport(string id)
        {
            return GetResult<string>(id);
        }
        /// <summary>
        /// 修改指定列的排序
        /// </summary>
        public ApiResult ChangeOrderNo(Sys_ReportArg model)
        {
            return GetResult(new { model.Id, model.OrderNo });
        }
        ///// <summary>
        ///// 交换两个行的排序
        ///// </summary>
        //public ApiResult SwapOrderNo(Sys_ReportArg src, Sys_ReportArg tar)
        //{
        //    ArgSwapOrderNo arg = new ArgSwapOrderNo
        //    {
        //        SrcId = src.Id,
        //        SrcOrderNo = src.OrderNo,
        //        TarId = tar.Id,
        //        TarOrderNo = tar.OrderNo
        //    };
        //    return GetResult(arg);
        //}

        public ApiResult SwapOrderNo(ArgSwapOrderNo arg)
        {
            return GetResult(arg);
        }

        public ApiResultList<string> GetComBoBoxData(string argId)
        {
            return GetResultList<string>(new ArgId(argId));
        }

        public ApiResult<RetReportData> GetReportData(ArgReportData arg)
        {
            return GetResult<RetReportData>(arg);
        }

        public ApiResult<RetPrintData> GetPrintData(ArgReportData arg)
        {
            return GetResult<RetPrintData>(arg);
        }

    }
}